﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TCDC_System.Register
{
    public partial class Register2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                /*** Create Session ***/
                SessionInit();

                SessionValue();
            }
        }

        private void SessionValue()
        {
            txtFirstNameEN.Text = Session["first_name_en"].ToString();
            txtLastNameEN.Text = Session["last_name_en"].ToString();
            txtFirstNameTH.Text = Session["first_name_th"].ToString();
            txtLastNameTH.Text = Session["last_name_th"].ToString();
            txtIDcard.Text = Session["id_card"].ToString();
        }

        private void SessionInit()
        {
            if (Session["first_name_en"] == null)
            {
                Session["first_name_en"] = "";
            }
            if (Session["last_name_en"] == null)
            {
                Session["last_name_en"] = "";
            }

            if (Session["first_name_th"] == null)
            {
                Session["first_name_th"] = "";
            }
            if (Session["last_name_th"] == null)
            {
                Session["last_name_th"] = "";
            }

            if (Session["id_card"] == null)
            {
                Session["id_card"] = "";
            }
        }

        protected void btnBack_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("Register1.aspx");
        }

        protected void btnNext_Click(object sender, ImageClickEventArgs e)
        {
            Session["first_name_en"] = txtFirstNameEN.Text;
            Session["last_name_en"] = txtLastNameEN.Text;
            Session["first_name_th"] = txtFirstNameTH.Text;
            Session["last_name_th"] = txtLastNameTH.Text;
            Session["id_card"] = txtIDcard.Text;
            Response.Redirect("Register3.aspx");
        }
    }
}